package com.mhh.selary.backend.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 协议类型
 *
 * @author mhh
 * @date 2020-09-17 17:24:42
 */
@Getter
@AllArgsConstructor
public enum ProtocolEnum {

    /**
     * http:1, https:2
     */
    HTTP("http", 1),

    HTTPS("https", 2),

    ;

    private String protocol;

    private Integer type;

    public static ProtocolEnum valueBy(Integer type) {
        return Arrays.stream(ProtocolEnum.values()).filter(enumItem -> enumItem.getType().equals(type)).findFirst().orElse(null);
    }
}
